# Contributor: Łukasz Jendrysik <scadu@yandex.com>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=bison
pkgver=3.6.4
pkgrel=0
pkgdesc="The GNU general-purpose parser generator"
arch="all"
license="GPL-3.0-or-later"
url="https://www.gnu.org/software/bison/bison.html"
makedepends="perl"
depends="m4"
checkdepends="bison flex"
[ -n "$BOOTSTRAP" ] && options="!check"
source="https://ftp.gnu.org/gnu/bison/bison-$pkgver.tar.xz"
subpackages="$pkgname-doc"

build() {
	./configure \
		--build=$CBUILD \
		--host=$CHOST \
		--prefix=/usr \
		--datadir=/usr/share \
		--infodir=/usr/share/info \
		--mandir=/usr/share/man
	make -j1
}

check() {
	make -j1 check
}

package() {
	make DESTDIR="$pkgdir" install
	rm -rf "$pkgdir"/usr/lib/charset.alias
	rmdir -p "$pkgdir"/usr/lib 2>/dev/null || true
}

sha512sums="041cd87f4ca6b012031719a49aa81e62d3c0817c6364289732e6a3cb9a0762498760e0f2ce84c03ca9e9b74eb74bdffd1b8b86d2b4a6e4a0d8c8a4b864b672dc  bison-3.6.4.tar.xz"
